home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / amos / fundraw.lha / fundraw.amos / fundraw.amosSourceCode
AMOS Source Code  |  1999-05-02  |  2KB  |  94 lines

  1. ' FunDraw version 1.0
  2. '
  3. ' left mouse to draw steps 
  4. ' right mouse to play sequence!
  5. ' (c)�99 D.Lenz (Vertex Entertainment) 
  6. ' http://www.vertex-entertainment.de.cx
  7. ' email: vertex@topmail.de 
  8. '
  9. Set Buffer 512
  10. Erase All 
  11. Screen Open 0,320,256,32,Lowres : Palette $0,$FFF
  12. Curs Off : Flash Off : Ink 1 : Cls 0 : Pen 1 : Paper 0
  13. Dim XP(2048),YP(2048)
  14. Global XP(),YP(),B,C,ST
  15. Change Mouse 2
  16. Do 
  17.    Cls 0 : C=0
  18.    Locate 0,0
  19.    Print "recording... (max. steps 2048)"
  20.    Print "step:";C
  21.    Repeat 
  22.       If Mouse Key=1
  23.          XM=X Screen(X Mouse) : YM=Y Screen(Y Mouse)
  24.          Plot XM,YM,1 : XP(C)=XM : YP(C)=YM
  25.          Inc C : Wait Vbl : Print At(5,1);C
  26.       End If 
  27.    Until Mouse Key=2 or C>2048
  28.    Cls 0
  29.    Locate 0,0 : Print "playing..." : Print "step:";B
  30.    Hide 
  31.    For B=0 To C
  32.       Print At(5,1);B
  33.       Ink Rnd(31)+1 : Circle XP(B),YP(B),Rnd(2)+1 : Wait Vbl 
  34.    Next 
  35.    Locate 0,25
  36.    Print "(S)ave Sequence"
  37.    Print "(L)oad Sequence"
  38.    Print "(N)ew Sequence"
  39.    Repeat : K$=Inkey$ : Until K$<>""
  40.    Show 
  41.    If K$="s" Then _SAVE_SEQ
  42.    If K$="l" Then _LOAD_SEQ
  43.    If K$="n" Then _NEW_SEQ
  44. Procedure _SAVE_SEQ
  45.    F$=Fsel$("work:*.fds","","give your new","sequence a name")
  46.    If F$=""
  47.       Pop Proc
  48.    Else 
  49.       Open Out 1,F$
  50.       Print #1,B
  51.       For C=0 To B
  52.          Print #1,XP(C)
  53.          Print #1,YP(C)
  54.       Next 
  55.       Close 1
  56.    End If 
  57. End Proc
  58. Procedure _LOAD_SEQ
  59.    F$=Fsel$("work:*.fds","","choose a fundraw-","sequence to load")
  60.    If F$=""
  61.       Pop Proc
  62.    Else 
  63.       Cls 0
  64.       Locate 0,0
  65.       Print "Loading Sequence..."
  66.       Open In 1,F$
  67.       On Error Goto _RHAN
  68.       Input #1,B
  69.       Print "Counting Steps..."
  70.       If B=0
  71.          _RHAN:
  72.          Print "Error loading sequence" : Wait Key : Resume : Pop Proc
  73.       End If 
  74.       Print "Reading Steps..."
  75.       For C=0 To B
  76.          On Error Goto _RHAN
  77.          Input #1,XP(C)
  78.          Input #1,YP(C)
  79.       Next 
  80.       Close 
  81.       Print "Done."
  82.       Wait 15
  83.       Cls 0
  84.       Locate 0,0 : Print "playing..." : Print "step:";B
  85.       For C=0 To B
  86.          Print At(5,1);C
  87.          Ink Rnd(31)+1 : Circle XP(C),YP(C),Rnd(2)+1 : Wait Vbl 
  88.       Next 
  89.    End If 
  90. End Proc
  91. Procedure _NEW_SEQ
  92.    Bell : Wait 1 : Sam Stop 
  93. End Proc
  94. Loop